package dao

import (
	"gitee.com/wao520/obtain_data/global"
	"gitee.com/wao520/obtain_data/model"
)

// 查询一条novels记录
func SelectOneNovels(id uint64) (*model.Novels, error) {
	fields := []string{"id", "title", "author", "genre", "description"}
	novelsOne := &model.Novels{}
	err := global.DBLink.Select(fields).Where("id=?", id).First(&novelsOne).Error
	if err != nil {
		return nil, err
	} else {
		return novelsOne, nil
	}
}
